#ifndef SCANCONTROLPRESET_H
#define SCANCONTROLPRESET_H
#include <QDialog>
#include <QGraphicsDropShadowEffect>
#include <QColor>
#include <QTabWidget>
#include <QTableWidget>
#include <QDebug>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QLabel>
#include <QMouseEvent>
#include <QVariantMap>

// 条纹相机序列号
#define PARAM_SERIAL_NUMBER "CameraSerialNumber"

// 档位参数宏定义（快0-7、中0-7、慢0-7）
#define PARAM_GEAR_FAST_0 "Fast0"
#define PARAM_GEAR_FAST_1 "Fast1"
#define PARAM_GEAR_FAST_2 "Fast2"
#define PARAM_GEAR_FAST_3 "Fast3"
#define PARAM_GEAR_FAST_4 "Fast4"
#define PARAM_GEAR_FAST_5 "Fast5"
#define PARAM_GEAR_FAST_6 "Fast6"
#define PARAM_GEAR_FAST_7 "Fast7"

#define PARAM_GEAR_MEDIUM_0 "Medium0"
#define PARAM_GEAR_MEDIUM_1 "Medium1"
#define PARAM_GEAR_MEDIUM_2 "Medium2"
#define PARAM_GEAR_MEDIUM_3 "Medium3"
#define PARAM_GEAR_MEDIUM_4 "Medium4"
#define PARAM_GEAR_MEDIUM_5 "Medium5"
#define PARAM_GEAR_MEDIUM_6 "Medium6"
#define PARAM_GEAR_MEDIUM_7 "Medium7"

#define PARAM_GEAR_SLOW_0 "Slow0"
#define PARAM_GEAR_SLOW_1 "Slow1"
#define PARAM_GEAR_SLOW_2 "Slow2"
#define PARAM_GEAR_SLOW_3 "Slow3"
#define PARAM_GEAR_SLOW_4 "Slow4"
#define PARAM_GEAR_SLOW_5 "Slow5"
#define PARAM_GEAR_SLOW_6 "Slow6"
#define PARAM_GEAR_SLOW_7 "Slow7"

// 开关参数宏定义
#define PARAM_SHUTTER_ENABLE "ShutterEnable"
#define PARAM_GAIN1_ENABLE "Gain1Enable"
#define PARAM_GAIN2_ENABLE "Gain2Enable"
#define PARAM_MCP_GATE_ENABLE "McpGateEnable"
#define PARAM_CATHODE_CONTROL_ENABLE "CathodeControlEnable"

namespace Ui {
class ScanControlPresetDialog;
}

class ScanControlPresetDialog : public QDialog
{
    Q_OBJECT

public:
    explicit ScanControlPresetDialog(QWidget *parent = nullptr);
    ~ScanControlPresetDialog();
    
    /**
     * @brief 设置UI数据
     * @param paramsMap 包含所有参数的QVariantMap
     */
    void setUIData(const QVariantMap &paramsMap);
    
    /**
     * @brief 收集UI数据
     * @return 包含所有参数的QVariantMap
     */
    QVariantMap getUIData();

private slots:
    /**
     * @brief 确认按钮点击槽函数
     */
    void onBtnConfirmClicked();
    
    /**
     * @brief 取消按钮点击槽函数
     */
    void onBtnCancelClicked();

protected:
    void mousePressEvent(QMouseEvent *event) override;
    void mouseMoveEvent(QMouseEvent *event) override;
    void mouseReleaseEvent(QMouseEvent *event) override;

private:
    Ui::ScanControlPresetDialog *ui;
    QWidget *titleBar;
    QLabel *titleLabel;
    QPushButton *closeButton;
    bool isDragging;
    QPoint dragPosition;
};

#endif // SCANCONTROLPRESET_H
